New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rezult

A value or error object

1.1.0
latest
Version published
Weekly downloads
6
500%
Maintainers
2
Weekly downloads
 
Created

A JavaScript value or error object.

var Result = require("rezult");

function safeJsonParse(string) {
    try {
        return new Result(null, JSON.parse(string));
    } catch (err) {
        return new Result(err);
    }
};

safeJsonParse("{}").toCallback(cb); // cb(null, {})
safeJsonParse("wat").toValue(); // throw SyntaxError

MIT License

Keywords

FAQs

Package last updated on 30 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts